﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VitCode.Castle.Entities;

namespace VitCode.WorkFlow.Entities
{
    class WorkFlowRecord : BaseEntity
    {
        public const string FIX_STATE_DOING = "Doing", FIX_STATE_WAITING = "Waiting", FIX_STATE_FINISH = "Finish";
        public virtual ActivityRecord ActivityRecord { get; set; }
        public virtual WorkItem WorkItem { get; set; }
        public virtual User OperatorUser { get; set; }
        /// <summary>
        /// 处理状态
        /// </summary>
        public virtual string FixState { get; set; }
        public virtual DateTime CreateTime { get; set; }
        public virtual DateTime? FinishTime { get; set; }
        public virtual string FixInfos { get; set; }

        /// <summary>
        /// 重写Equals方法
        /// </summary>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, this))
                return true;
            if (obj == null)
                return false;
            var sObj = obj as WorkFlowRecord;
            return sObj != null && (sObj.Id == m_Id || (sObj.ActivityRecord == ActivityRecord && sObj.WorkItem == WorkItem));
        }

        /// <summary>
        /// 重写GetHashCode方法
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 37;
            hash = 23 * hash * Id.GetHashCode();
            return hash;
        }

    }
}
